Cognitoware.Robotics.dll
Class CompleteHistogram<T>
T: The type of the values whose probabilities are represented in the distribution.
Summary
A distribution that uses weighted ranges to approximate the probability distribution across a continuous value.
Constructor Summary
Creates a new histogram with the same ranges as the argument.
Creates a new histogram.
Method Summary
Increases the count of one of the histogram ranges.
AliasAs()
Inherited from Cognitoware.Mathematics.Probability.RandomDistribution
Equals(Object)
Inherited from System.Object
Finalize()
Inherited from System.Object
Removes ranges from the histogram if they have a probability below the specified threshold.
GetEntropy(IEnumerable<T>)
Inherited from Cognitoware.Mathematics.Probability.RandomDistribution
GetHashCode()
Inherited from System.Object
GetType()
Inherited from System.Object
Gets the maximum value for one dimension.
MemberwiseClone()
Inherited from System.Object
Gets the minimum value for one dimension.
Returns the probability of a point in T.
Gets the probability of a range selected by index.
Gets the number of ranges for one dimension.
Selects a random value from the distribution with a probability consistent with the distribution.
Adds samples from a different RandomDistribution to this histogram.
ToString()
Inherited from System.Object
Details
A distribution that uses weighted ranges to approximate the probability distribution across a continuous value.
Each range has a minimum and maximum value for each dimension.
For a data type with two dimensions, the range is a rectangle. For a data type with three dimensions, the range is a box.
CompleteHistogram uses nested arrays to represent the distribution.
The storage for a CompleteHistogram is M^N, where N is the number of dimensions and M is the number of bins.
Constructor Details
public CompleteHistogram(CompleteHistogram<T> that, Boolean copyValues)
Creates a new histogram with the same ranges as the argument.
If copyValues is false, the new histogram will only have the same ranges but will be initialized without any probabilities in the ranges.
If copyValues is true, the new histogram will have the same probability values as the argument.
Parameters:
that
- The histogram to copy.
copyValues
- A boolean that determines if the range weights should be copied.
public CompleteHistogram(T min, T max, Int32[] binCount)
Creates a new histogram.
The number of ranges in each dimension is determined by the binCount array argument.
The global minimum and maximum of the ranges are determined by the min and max arguments.
Values outside of the global ranges have zero probability.
Parameters:
min
- The global minimum of the histogram.
max
- The global maximum of the histogram.
binCount
- The number of ranges across each dimension.
Method Details
public void AddInformation(T point, Double weight)
Increases the count of one of the histogram ranges.
The point argument is used to determine a single range and the weight is added to that range's weight.
The weight is also added to the total sum of weights to normalize the range weights.
Parameters:
point
- The point to add to the distribution.
weight
- The weight to add to the distribution.
public void ForgetDetails(Double threshold)
Removes ranges from the histogram if they have a probability below the specified threshold.
This function can be used to reduce the computational cost of a HistogramFilter by removing ranges that have a near zero probability.
Parameters:
threshold
- The probability threshold used to removed unlikely ranges from the distribution.
public Double Max(Int32 fieldIndex)
Gets the maximum value for one dimension.
Parameters:
fieldIndex
- The index of the dimension.
Returns:
The maximum value of the specified dimension.
public Double Min(Int32 fieldIndex)
Gets the minimum value for one dimension.
Parameters:
fieldIndex
- The index of the dimension.
Returns:
The minimum value of the specified dimension.
public override Double ProbabilityOf(T point)
Returns the probability of a point in T.
The range that contains the specified point is determined and the probability of that range is returned.
Parameters:
point
- The value whose probability is returned.
Returns:
The probability of the specified point.
public Double ProbabilityOfRange(Int32[] indexes)
Gets the probability of a range selected by index.
Each dimension is divided into a Nd ranges indexed by [0..Nd-1].
Parameters:
indexes
- The indexes of each dimension.
Returns:
The probability of the specified range.
public Int32 RangeCount(Int32 fieldIndex)
Gets the number of ranges for one dimension.
Parameters:
fieldIndex
- The index of the dimension.
Returns:
The number of ranges in the specified dimension.
public override T Sample(Random select)
Selects a random value from the distribution with a probability consistent with the distribution.
Parameters:
select
- A random number generator used to select the value.
public void SampleDistribution(RandomDistribution<T> pt, Int32 samples, Double priorWeight, Random select)
Adds samples from a different RandomDistribution to this histogram.
This method can be used to create a histogram that approximates another distribution.
It can also be called multiple times to creates mixtures of distributions.
Parameters:
pt
- The distribution from which to select samples.
samples
- The number of samples to pull from the parameter distribution.
priorWeight
- A weight to apply to each sample.
select
- The random number generator used to sample the parameter distribution.